package cn.besbing.server.service.primary;


import cn.besbing.model.entities.primary.NcProdList;
import cn.besbing.model.entities.primary.NcProdListExample;
import cn.besbing.model.entities.primary.NcProdListKey;
import cn.besbing.model.entities.primary.Product;
import cn.besbing.model.mapper.primary.NcProdListMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PrimaryNcProdListServiceImpl implements NcProdListMapper{

    @Autowired(required = false)
    NcProdListMapper ncProdListMapper;


    @Override
    public long countByExample(NcProdListExample example) {
        return ncProdListMapper.countByExample(example);
    }

    @Override
    public int deleteByExample(NcProdListExample example) {
        return ncProdListMapper.deleteByExample(example);
    }

    @Override
    public int deleteByPrimaryKey(NcProdListKey key) {
        return ncProdListMapper.deleteByPrimaryKey(key);
    }

    @Override
    public int insert(NcProdList record) {
        int i = 0;
        try {
           i = ncProdListMapper.insert(record);
            System.out.println(i);
        }catch (Exception e){
            System.out.println(e);
        }
        return i;
    }

    public int insertValue(NcProdList record) {
        int i = 0;
        try {
            i = ncProdListMapper.insert(record);
            System.out.println(i);
        }catch (Exception e){
            System.out.println(e);
        }
        return i;
    }

    @Override
    public int insertSelective(NcProdList record) {
        return ncProdListMapper.insertSelective(record);
    }

    @Override
    public List<NcProdList> selectByExample(NcProdListExample example) {
        return ncProdListMapper.selectByExample(example);
    }

    @Override
    public NcProdList selectByPrimaryKey(NcProdListKey key) {
        NcProdList p = new NcProdList();
        try{
           p = selectByPrimaryKey(key);
        }catch (Exception e){
            e.printStackTrace();
        }
        return p;
    }

    @Override
    public int updateByExampleSelective(NcProdList record, NcProdListExample example) {
        return ncProdListMapper.updateByExampleSelective(record,example);
    }

    @Override
    public int updateByExample(NcProdList record, NcProdListExample example) {
        return ncProdListMapper.updateByExample(record, example);
    }

    @Override
    public int updateByPrimaryKeySelective(NcProdList record) {
        return ncProdListMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(NcProdList record) {
        return ncProdListMapper.updateByPrimaryKey(record);
    }
}
